
package com.tsh.core.mp.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 *  简单的数据库公共实体类， 没有更新人和更新时间
 *
 * @author Mosj
 * @since 2023-06-06
 */
@Data
public class SimpleCommonEntity implements Serializable {

	/**
	 * 主键id
	 */
	@ApiModelProperty(value = "主键id", example = "1", position = -100)
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	@JsonSerialize(using = ToStringSerializer.class)
	private Long id;

	/**
	 * 创建人
	 */
	@ApiModelProperty(value = "创建人ID", example = "1", position = 94, hidden = true)
	@JsonSerialize(using = ToStringSerializer.class)
	private Long createUserId;

	/**
	 * 创建人姓名
	 */
	@ApiModelProperty(value = "创建人姓名", example = "管理员", position = 95, hidden = true)
	private String createUserName;

	/**
	 * 创建时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@ApiModelProperty(value = "创建时间", example = "2022-11-03 14:09:20", position = 96, hidden = true)
	private LocalDateTime createDate;

	/**
	 * 记录标识，0正常，1删除
	 */
	@ApiModelProperty(value = "记录标识，1正常，0删除", example = "1", position = 100, hidden = true)
	@TableLogic(value = "1", delval = "0")
	private Integer recordFlag;

}
